<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<HTML>
	<HEAD>
		<meta http-equiv="Content-Language" content="zh-cn">
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<link href="${pageContext.request.contextPath}/css/Style1.css" rel="stylesheet" type="text/css" />
		<script language="javascript" src="${pageContext.request.contextPath}/js/jquery-1.8.3.js"></script>
		<script language="javascript" src="${pageContext.request.contextPath}/layer/layer.js"></script>
		<script type="text/javascript">
		function showDetail(oid){
			$.post("${pageContext.request.contextPath}/adminOrder_findOrderItem.action",{"oid":oid},function(data){
				var s = "<table border='1' width='99%'>";
				s += "<tr><th>商品图片</th><th>商品名称</th><th>购买数量</th></tr>"
				$(data).each(function(){
					s += "<tr><td>";
					s += "<img width='40' height='45'style='padding-left: 35%' src='/images/"+this.product.image+"'></td>"
					s += "<td>"+this.product.pname+"</td><td>"+this.count+"</td></tr>"
				});
				s += "</table>";
				layer.open({
			        type: 1,//0:信息框; 1:页面; 2:iframe层;	3:加载层;	4:tip层
			        title:"订单详情",//标题
			        area: ['50%', '40%'],//大小
			        shadeClose: true, //点击弹层外区域 遮罩关闭
			        content: s//内容
			    });
			},"json");
		}
		</script>
	</HEAD>
	<body>
		<br>
		<form id="Form1" name="Form1" action="${pageContext.request.contextPath}/user/list.jsp" method="post">
			<table cellSpacing="1" cellPadding="0" width="100%" align="center" bgColor="#f5fafe" border="0">
				<TBODY>
					<tr>
						<td class="ta_01" align="center" bgColor="#afd1f3">
							<strong>订单列表</strong>
						</TD>
					</tr>
					
					<tr>
						<td class="ta_01" align="center" bgColor="#f5fafe">
							<table cellspacing="0" cellpadding="1" rules="all"
								bordercolor="gray" border="1" id="DataGrid1"
								style="BORDER-RIGHT: gray 1px solid; BORDER-TOP: gray 1px solid; BORDER-LEFT: gray 1px solid; WIDTH: 100%; WORD-BREAK: break-all; BORDER-BOTTOM: gray 1px solid; BORDER-COLLAPSE: collapse; BACKGROUND-COLOR: #f5fafe; WORD-WRAP: break-word">
								<tr
									style="FONT-WEIGHT: bold; FONT-SIZE: 12pt; HEIGHT: 25px; BACKGROUND-COLOR: #afd1f3">

									<td align="center" width="10%">
										序号
									</td>
									<td align="center" width="10%">
										订单编号
									</td>
									<td align="center" width="10%">
										订单金额
									</td>
									<td align="center" width="10%">
										收货人
									</td>
									<td align="center" width="10%">
										订单状态
									</td>
									<td align="center" width="50%">
										订单详情
									</td>
								</tr>
									<s:iterator var="o" value="pageBean.data" status="status">
										<tr onmouseover="this.style.backgroundColor = 'white'"
											onmouseout="this.style.backgroundColor = '#F5FAFE';">
											<td style="CURSOR: hand; HEIGHT: 22px" align="center"
												width="18%">
												<s:property value="#status.count"/>
											</td>
											<td style="CURSOR: hand; HEIGHT: 22px" align="center"
												width="17%">
												<s:property value="#o.oid"/>
											</td>
											<td style="CURSOR: hand; HEIGHT: 22px" align="center"
												width="17%">
												<s:property value="#o.total"/>
											</td>
											<td style="CURSOR: hand; HEIGHT: 22px" align="center"
												width="17%">
												<s:property value="#o.name"/>
											</td>
											<td style="CURSOR: hand; HEIGHT: 22px" align="center"
												width="17%">
												<s:if test="#o.state==1">
													未付款
												</s:if>
												<s:if test="#o.state==2">
													<a href="${ pageContext.request.contextPath }/adminOrder_updateState.action?oid=<s:property value="#o.oid"/>"><font color="blue">发货</font></a>
												</s:if>
												<s:if test="#o.state==3">
													等待确认收货
												</s:if>
												<s:if test="#o.state==4">
													订单完成
												</s:if>
											
											</td>
							
											<td align="center" style="HEIGHT: 22px">
												<input type="button" value="订单详情"  onclick="showDetail('<s:property value="#o.oid"/>')"/>
											</td>
							
										</tr>
									</s:iterator>	
							</table>
						</td>
					</tr>
			<tr align="center">
									<td colspan="7">
								<div class="pagination">
		<span>第<s:property value = "pageBean.pageNumber"/>/<s:property value = "pageBean.page"/></span>
			<s:if test="pageBean.pageNumber != 1">
				<a href="${pageContext.request.contextPath}/adminOrder_findAll.action?pageNumber=1" class="firstPage">&nbsp;</a>
				<a href="${pageContext.request.contextPath}/adminOrder_findAll.action?pageNumber=<s:property value="pageBean.pageNumber-1"/>" class="previousPage">&nbsp;</a>
			</s:if>
			
			<s:iterator  var="n" begin="1" end="pageBean.page">
				<s:if test="pageBean.pageNumber != #n">
					<a href="${pageContext.request.contextPath}/adminOrder_findAll.action?pageNumber=<s:property value="#n"/>"><s:property value="#n"/></a>
				</s:if>
				<s:else>
					<span class="currentPage"><s:property value="#n"/></span>
				</s:else>
			</s:iterator>
			<s:if test="pageBean.pageNumber != pageBean.page">				
				<a class="nextPage" href="${pageContext.request.contextPath}/adminOrder_findAll.action?pageNumber=<s:property value="pageBean.pageNumber+1"/>">&nbsp;</a>
				<a class="lastPage" href="${pageContext.request.contextPath}/adminOrder_findAll.action?pageNumber=<s:property value="pageBean.page"/>">&nbsp;</a>
			</s:if>
		
	</div>
					</tr>
				</TBODY>
			</table>
		</form>
	</body>
</HTML>


